/*
 *
 * 名称：奇门遁甲窗口
 * 功能：奇门遁甲九宫显示窗口
 * 作者：清河张
 * 时间：2025.05.11
 *
 */

#ifndef QMDJWIN_H
#define QMDJWIN_H

#include <QMainWindow>
#include <QTextBrowser>
#include "qmgong9.h"
#include "fangan.h"
#include "fanganwin.h"

namespace Ui {
class QMDJWIN;
}

namespace QMDJ {

class QMDJWIN : public QMainWindow
{
    Q_OBJECT

public:
    explicit QMDJWIN(QWidget *parent, QMGONG9& gong9);
    ~QMDJWIN();

    //根据用神表，显示用神
    void ysshow(const FANGAN::YSMAP & ysmap);

    //排盘显示
    void paipanxianshi( int ju, int yy, const GAN10& qi, const GAN10& luo, const BAZI& bz);

    //各控件响应函数
private slots:

    void on_tToolButton0_clicked();

    void on_tToolButton1_clicked();

    void on_fToolButton0_clicked();

    void on_ftoolButton1_clicked();

    void on_houttianToolButton_clicked();

    void on_xiantianToolButton_clicked();

    void on_jianglaiToolButton_clicked();

    void on_guoquToolButton_clicked();

    void on_yinganToolButton_clicked();

    void on_anganToolButton_clicked();

    void on_cunToolButton_clicked();

    void on_textBrowser0_selectionChanged();

    void on_textBrowser1_selectionChanged();

    void on_textBrowser2_selectionChanged();

    void on_textBrowser3_selectionChanged();

    void on_textBrowser4_selectionChanged();

    void on_textBrowser5_selectionChanged();

    void on_textBrowser6_selectionChanged();

    void on_textBrowser7_selectionChanged();

    void on_textBrowser8_selectionChanged();

    void on_ysgTableWidget_cellClicked(int row, int column);

private:

    void initcbx();//初始化控件

    void fullshow();//全窗口显示某宫

    void keyPressEvent(QKeyEvent *event) override;

    void closeEvent(QCloseEvent *event) override;

    void g9show();//刷新显示

    void bazishow(const BAZI& bz);//起盘

    void tiaozheng(int,int,int);//调整

    void gaoliang(QMGONG9::GONG* cur); //选中高亮

    Ui::QMDJWIN *ui;
    QMGONG9::GONG* _cur;
    QTextBrowser* _displays[9];
    bool _focused;
    QMGONG9& _gong9;
};

};
#endif // QMDJWIN_H
